/*
 * @Author: 徐博
 * @Date: 2023-02-17 17:44:52
 * @Last Modified by: 徐博
 * @Last Modified time: 2023-02-20 10:03:47
 */

// cookie方法
export default class Cookie {
    static get(name: string) {
        let v = window.document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
        return v ? v[2] : null;
    }
    static set(name: string, value: any, days = 1) {
        let d = new Date;
        d.setTime(d.getTime() + 24*60*60*1000*days);
        window.document.cookie = name + "=" + value + ";path=/;expires=" + d.toUTCString();
    }
    static delete(name:string) {
        this.set(name, '', -1);
    }
}

export const Money =(price: string | number)=>  {
    return String(Number(price).toFixed(2)).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
